package com.uni.vo;


import com.alibaba.fastjson.JSONObject;

import java.util.HashMap;
import java.util.Map;

public class RestResponse {
    private static final String SUCCESS = "success";
    private static final String FAIL = "fail";
    public static String response(Object obj){
        return JSONObject.toJSONString(obj);
    }
    public static String success(Object obj){
        Map<String, Object> map = new HashMap<>();
        map.put("status", SUCCESS);
        map.put("response", obj);
        return JSONObject.toJSONString(map);
    }
    public static String fail(Object obj){
        Map<String, Object> map = new HashMap<>();
        map.put("status", FAIL);
        map.put("response", obj);
        return JSONObject.toJSONString(map);
    }
}
